<template>
  <el-form :model="form" label-width="120px" :show-message="false" ref="form" :rules="rules" :inline="true">
    <el-form-item label="跟进时间:" prop="anewVisitTime">
      <el-date-picker
        v-model="form.currentTime"
        style="width: 209px"
        type="datetime"
        :disabled="true"
        placeholder="跟进时间:"
      ></el-date-picker>
    </el-form-item>
    <el-form-item label="下次跟进时间:" prop="followUpTime">
      <el-date-picker
        v-model="form.followUpTime"
        style="width: 209px"
        type="datetime"
        placeholder="下次跟进时间:"
      ></el-date-picker>
    </el-form-item>
    <el-form-item label="跟进备注:" prop="remark">
      <el-input type="textarea" v-model="form.remark" clearable maxlength="1000" style="width: 500px" show-word-limit :autosize="{ minRows: 4, maxRows: 6 }" placeholder="备注"></el-input>
    </el-form-item>
    <el-row>
      <el-col :span="24" align="center">
        <el-form-item>
          <el-button type="primary" style="border: 0;width: 100px" @click="onSubmit">保存</el-button>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
  import { parseTimeToYMDHMS } from '@/utils'
  export default {
    name: 'DialogDataForm',
    props: {
      value: {
        type: Object,
        default: () => ({
        })
      }
    },
    data() {
      return {
        dict: {},
        form: {
          chanceId: this.value.id,
          currentTime: parseTimeToYMDHMS(new Date()),
          followUpTime: null,
          remark: ''
        },
        rules: {
          followUpTime: [{ required: true, trigger: 'change' }],
          remark: [{ required: true, trigger: 'blur' }]

        }
      }
    },
    methods: {
      onSubmit() {
        this.$refs.form.validate(valid => {
          if (valid) {
            const options = this.form;
            this.form.followUpTime = parseTimeToYMDHMS(this.form.followUpTime);
            this.$emit('operate', options)
          } else {
            return false
          }
        })
      }
    }
  }
</script>
<style lang="scss" scoped>
</style>

